package com.you.common.util;

import com.you.common.model.Response;

/**
 *<p>
 *response util
 *</p>
 *
 * @author : liuyang53 2018-07-16 星期一 下午 04:09:24
 * @version : V1.0
 */
public class ResponseUtil {

    private ResponseUtil() {
    }

    public static Response success() {
        return success(null);
    }

    @SuppressWarnings("unchecked")
    public static Response success(Object object) {
        Response response = new Response();
        response.setCode(200);
        response.setMsg("success");
        response.setData(object);
        return response;
    }

    @SuppressWarnings("unchecked")
    public static Response success(Object object, String msg) {
        Response response = new Response();
        response.setCode(200);
        response.setMsg(msg);
        response.setData(object);
        return response;
    }

    public static Response error(Integer code, String msg) {
        Response response = new Response();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }

}
